// detail 商品详情仓库
import { getGoods, addShoppingCar } from '../../../Api/index.js'
const detailAbout = {
  namespaced: true,
  actions: {
    // 获取商品详情
    async getGoods ({ commit }, value) {
      const { data } = await getGoods(value)
      commit('GETGOODS', data)
    // 添加购物车
    },
    async addShoppingCar ({ commit }, value) {
      const result = await addShoppingCar(value)
      commit('ADDSHOPPINGCAR', result)
    }
  },
  mutations: {
    GETGOODS (state, value) {
      state.goodsDetail = value
    },
    ADDSHOPPINGCAR (state, value) {
      state.addCar = value
    }
  },
  state: {
    goodsDetail: {},
    addCar: {}
  }
}
export default detailAbout
